package com.aloneness.dingtalk.learn.domain;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@ToString
@Setter
@Getter
public class ResponseBean<T> {

    private Integer code;
    private String message;
    private T data;

    public static <T> ResponseBean success(T data){
        ResponseBean responseBean = new ResponseBean();
        responseBean.setCode(200);
        responseBean.setMessage("success");
        responseBean.setData(data);
        return responseBean;
    }

    public static <T> ResponseBean fail(){
        ResponseBean responseBean = new ResponseBean();
        responseBean.setCode(500);
        responseBean.setMessage("fail");
        return responseBean;
    }
}
